package com.prs.crm.domain.store;

/**
 * @author 兰小刚
 * @version 
 * 类说明
 */
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

import com.prs.crm.context.Attach;
import com.prs.crm.domain.Attachment;
import com.prs.crm.domain.FlowEntity;

@Entity
@Table(name = "stock_inventory")
public class Inventory extends FlowEntity {

	private static final long serialVersionUID = 1L;
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	/**
	 * 盘点主题
	 */
	private String inventoryName;

	/**
	 * 仓库
	 */
	@ManyToOne
	private StoreRoom room;

	/**
	 * 盘点日期
	 */
	private Date inventoryDate;

	/**
	 * 盘点明细
	 */
	@OneToMany(mappedBy = "inventory")
	@Cascade( { org.hibernate.annotations.CascadeType.ALL,
			org.hibernate.annotations.CascadeType.DELETE_ORPHAN })
	private Set<InventoryDetail> details;

	/**
	 * 盘点概要
	 */
	@Lob
	private String remark;
	private int flowType;
	

	/**
	 * 批号
	 * 
	 * @return
	 */
	private String batchNum;
	/**
	 * 附件
	 */
	private String inventoryAttach;
	private String inventoryType;

	public String getInventoryType() {
		return inventoryType;
	}

	public void setInventoryType(String inventoryType) {
		this.inventoryType = inventoryType;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getInventoryName() {
		return inventoryName;
	}

	public void setInventoryName(String inventoryName) {
		this.inventoryName = inventoryName;
	}

	public StoreRoom getRoom() {
		return room;
	}

	public void setRoom(StoreRoom room) {
		this.room = room;
	}

	public Date getInventoryDate() {
		return inventoryDate;
	}

	public void setInventoryDate(Date inventoryDate) {
		this.inventoryDate = inventoryDate;
	}

	public Set<InventoryDetail> getDetails() {
		return details;
	}

	public void setDetails(Set<InventoryDetail> details) {
		this.details = details;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void addDetail(InventoryDetail detail) {
		if (details == null)
			details = new HashSet<InventoryDetail>();
		detail.setInventory(this);
		details.add(detail);
	}

	public String getBatchNum() {
		return batchNum;
	}

	public void setBatchNum(String batchNum) {
		this.batchNum = batchNum;
	}

	public String getInventoryAttach() {
		return inventoryAttach;
	}

	public void setInventoryAttach(String inventoryAttach) {
		this.inventoryAttach = inventoryAttach;
	}
	public int getFlowType() {
		return flowType;
	}

	public void setFlowType(int flowType) {
		this.flowType = flowType;
	}

	
}
